
///// <summary>
///// This or chatAgent might need change, since we might want to try, each agent can only talk to his peer, level+1 or -1 agent
///// But since talking to different level of peer mostly happen at different stage, we could keep it one on one for now
///// </summary>
//[Serializable]
//public class ChatChainModel
//{
//    // /// <summary>
//    // /// MsgCoordinator is not in ChatAgents as he is not part of the team
//    // /// </summary>
//    // public ChatAgentBase MessageCoordinator;

//    public readonly Dictionary<ChatAgentEnum, ChatAgent> AgentsInvolved = new();

//    //This is predefined in the config, will be stored here on initialization
//    public List<ChatChainPhase> Phases = new();
//    public bool chainFinished = false;
//    public TalkingOrder TalkingOrder;

//    public ChatChainPhase CurChatChainPhase
//    {
//        get
//        {
//            if (_phaseIndex < 0)
//            {
//                return null;
//            }
//            return Phases[_phaseIndex];
//        }
//    }

//    //this will store chatRooms that should be executed in parallel
//    public ChatStep CurChatStep
//    {
//        get
//        {
//            if (_phaseIndex < 0 || _stepIndex < 0)
//            {
//                return null;
//            }
//            return Phases[_phaseIndex].phaseSteps[_stepIndex];
//        }
//    }

//    private int _phaseIndex = -1;
//    private int _stepIndex = -1;


//    /// <summary>
//    /// If it returns false, it means it reached an end
//    /// </summary>
//    /// <returns></returns>
//    public bool TryMoveNextIndexing()
//    {
//        if (_phaseIndex < 0 && _stepIndex < 0)
//        {
//            _phaseIndex = 0;
//            _stepIndex = 0;
//            return true;
//        }
//        else
//        {
//            //if not last step in phase
//            if (_stepIndex < Phases[_phaseIndex].phaseSteps.Count - 1)
//            {
//                _stepIndex++;
//                return true;
//            }
//            else
//            {
//                //if not last phase
//                if (_phaseIndex < Phases.Count - 1)
//                {
//                    _phaseIndex++;
//                    _stepIndex = 0;
//                    return true;
//                }
//                else
//                {
//                    chainFinished = true;
//                    return false;
//                }

//            }
//        }
//    }

//    public void Reset()
//    {
//        _phaseIndex = -1;
//        _stepIndex = -1;
//        chainFinished = false;
//        AgentsInvolved.Clear();
//        foreach (var chatChainPhase in Phases)
//        {
//            foreach (var phaseStep in chatChainPhase.phaseSteps)
//            {
//                foreach (var chatRoom in phaseStep.chatRooms)
//                {
//                    chatRoom.Agents.Clear();
//                }
//            }
//        }
//    }
//}

//[Serializable]
//public class ChatChainPhase
//{
//    public string phaseName;
//    public string phaseDescription;
//    public List<ChatStep> phaseSteps;
//}

//[Serializable]
//public class ChatStep
//{
//    public string chatStepPurpose;
//    public List<ChatRoom> chatRooms;
//}

//[Serializable]
//public class ChatRoom
//{
//    private Dictionary<ChatAgentEnum, bool> voteForChatRoomCompletion = new Dictionary<ChatAgentEnum, bool>();

//    public ChatAgentEnum meetingHost;
//    public string meetingHostInitiator;

//    public string roomName;
//    public string roomGoal;

//    public List<RequiredAgentInRoomInfo> agentRequired = new();

//    public List<ChatAgent> Agents = new();
//    [NonSerialized] public bool ChatRoomCompleted = false;
//    // TODO: [HideInInspector] public bool roomFinished = false; //currently we only support 1 room at a time, fuck multiRoom;

//    public ChatAgentEnum LastAuthorizedAgent { get; private set; }

//    public void UpdateLastAuthorizedAgent(ChatAgentEnum agentEnum)
//    {
//        LastAuthorizedAgent = agentEnum;
//    }

//    public void VoteForChatRoomCompletion(ChatAgentEnum agent, bool voteForCompletion)
//    {
//        voteForChatRoomCompletion[agent] = voteForCompletion;
//    }

//    public bool ChatRoomCompletionVoteResult()
//    {
//        foreach (var agent in Agents)
//        {
//            //client would not be voting directly, but influencing how other members vote
//            if (agent.agentEnum == ChatAgentEnum.Client)
//            {
//                continue;
//            }

//            //havent voted yet
//            if (voteForChatRoomCompletion.ContainsKey(agent.agentEnum) == false)
//            {
//                return false;
//            }

//            //one of the members voted false
//            if (voteForChatRoomCompletion[agent.agentEnum] == false)
//            {
//                return false;
//            }
//        }

//        return true;
//    }

//    public void Reset()
//    {
//        Agents.Clear();
//        ChatRoomCompleted = false;
//        voteForChatRoomCompletion.Clear();
//    }

//    public ChatAgent this[ChatAgentEnum targetAgent] {
//        get
//        {
//            foreach (var agent in Agents)
//            {
//                if (agent.agentEnum == targetAgent)
//                {
//                    return agent;
//                }
//            }

//            return null;
//        }
//    }
//}

//[Serializable]
//public class RequiredAgentInRoomInfo
//{
//    public ChatAgentEnum agentEnum;
//    public string agentGoal;
//}